// xhLineCap.h: interface for the xhLineCap class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_XHLineCAP_H__858EF1B8_ABA9_46B9_BE53_C902694AD817__INCLUDED_)
#define AFX_XHLineCAP_H__858EF1B8_ABA9_46B9_BE53_C902694AD817__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "../HubCapMan/LineCapPlug.h"
#include "DDThread3.h"

//#define _DKQ_TEST

#ifdef _DKQ_TEST
#include "..\DDPublic\DDLogInfo.h"
#endif

class xhLineCap 
{
public:
	xhLineCap();
	virtual ~xhLineCap();

public:
	int Initialize();
	int UnInitialize();
	int SetHwnd(HWND hWnd);
	int UnLock();

	int GetCaptureList(zkCapDevDesc **ppDescs,int &nCount);
	int SelectCapture(zkCapDevDesc *pDesc);

public:
	int RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext);
	
public:
	int OpCaptureParam(void *pVoid);  //zkFCaptureParam
	int GetLineSize(int &nWidth,int &nHeight);
	int GetLineInfo(zkImgBitInfo **ppImgBitInfo);
	
public:
	//start
	int StartCapture();
	//stop 
	int StopCapture();
	//
	int	Draw(void *pVoid = NULL);
	//get the capture Line data
	int GetLineData(zkImgBitInfo **ppImgBitInfo);
	//get histogram information
	int GetLiveHistogramInfo(void **ppHistogram);
	int GetGrayValue(int x,int y,DWORD &dwGray);

public:
	int SelectBadPixelFile(char *pFileName);
	//select the Line revise file
	int SelectReviseFile(char *pFileName,int nCreateRevise);

public:
	int CreateRevise(void *pVoid=NULL);
	int SetReviseGrade(int nGrade);
	int SaveReviseFile(char *pFileName);

public:
	int CreateBadPixelRevise(void *pVoid=NULL);
	int SetBadPixelReviseGrade(int nGrade);
	int SaveBadPixelReviseFile(char *pFileName);
	int GetBadPixelValue(int x,int y,DWORD &dwValue);
	int SetBadPixelValue(int x,int y,DWORD dwValue);

public:
	int SetRecordParam(void *pVoid = NULL);
	int StartRecord(char *pFileName);
	int StopRecord();

private:
	int LoadCaptureType();
	int LoadPlug( char *pFileName );
	int InitPlug();

private:
	BOOL              m_bLoadCap;
	int               m_nDevCount;
	zkCapDevDesc      m_xDevDescs[DDCAPDEVCOUNT];
    DDCriticalSection m_Lock;

private:
	HWND  m_hWnd;
	OnDrawCallBackFun m_funCallBack;
	void             *m_pContext;

private:
	char m_szPlugDir[MAX_PATH];

private:
	zkCapDevDesc m_xUseDevDesc;

	HINSTANCE   m_hPlugDll;
	LineCapPlug *m_pLineCapPlug;

#ifdef _DKQ_TEST
	DDLogInfo m_xLogInfo;
#endif


};

#endif // !defined(AFX_XHLineCAP_H__858EF1B8_ABA9_46B9_BE53_C902694AD817__INCLUDED_)
